import 'package:json_annotation/json_annotation.dart';

part 'groupMessages.g.dart';

@JsonSerializable(explicitToJson: true)
class GroupMessages {
  List<GroupMessage> messages;

  GroupMessages(this.messages);

  factory GroupMessages.fromJson(Map<String, dynamic> json) =>
      _$GroupMessagesFromJson(json);

  Map<String, dynamic> toJson() => _$GroupMessagesToJson(this);
}

@JsonSerializable(explicitToJson: true)
class GroupMessage {
  int group_id;
  int sender_id;
  String message;
  int time;

  factory GroupMessage.fromJson(Map<String, dynamic> json) =>
      _$GroupMessageFromJson(json);

  GroupMessage(this.group_id, this.sender_id, this.message, this.time);

  Map<String, dynamic> toJson() => _$GroupMessageToJson(this);
}
